package com.tpc.pictool.service;


import com.tpc.pictool.utils.JDBCUtil;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

import com.tpc.pictool.utils.SystemUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ArrayListHandler;

public class FileService {
    public FileService() {
    }

    public List<Object[]> getFileName() {
        List<Object[]> result = null;
        Connection connection = null;
        try {
            connection = JDBCUtil.getConnection();
            QueryRunner queryRunner = new QueryRunner();
            String sql = "SELECT a.Annexid,b.folderurl||'"+ SystemUtil.getFileHyphen()+"'||a.Annexid||'_'||a.filename FROM KmAttachment a join KmFolder b on a.PlaceId=b.PlaceId where filename like '%.pdf' and a.tbname='BatchCode'\n";
            System.out.println(sql);
            result = (List)queryRunner.query(connection, sql, new ArrayListHandler());
        } catch (SQLException var5) {
            var5.printStackTrace();
        }finally {
            if(connection!=null){
                try {
                    connection.close();
                } catch (SQLException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        return result;
    }
}
